import Vue from 'vue'
import Router from 'vue-router'
import Home from './views/Home.vue'
import Main from './views/main/main.vue'

Vue.use(Router)

export default new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
    {
      path: '/',
      redirect: '/home'
    },
    {
      path: '/#',
      redirect: '/home',
      component: Main,
      children: [
        {
          path: '/home',
          component: () => import('./components/test1.vue'),
          children: [
            {
              path: 'test',
              component: () => import('./views/login/login.vue')
            }
          ]
        },
        {
          path: 'login',
          component: () => import('./views/login/login.vue')
        },
        {
          path: '/Project',
          redirect: '/Project/index'
        },
        {
          path: '/Project/create',
          component: () => import('./views/project/create.vue')
        },
        {
          path: '/Project/index',
          component: () => import('./views/project/index.vue')
        },
        {
          path: '/Project/auditing',
          component: () => import('./views/project/create.vue')
        },
        {
          path: '/Project/create',
          component: () => import('./views/project/create.vue')
        },
        {
          path: '/Sampling',
          component: () => import('./views/sampling/samplingBase.vue'),
          redirect: '/Sampling/plan',
          children: [
            {
              path: 'plan',
              component: () => import('./views/sampling/plan.vue')
            },
            {
              path: 'mission',
              component: () => import('./views/sampling/sampling.vue')
            },
            {
              path: 'test',
              component: () => import('./components/test1.vue')
            }
          ]
        },
        {
          path: '/Sampling/SamplingList/:id/:title',
          component: () => import('./views/sampling/samplingList.vue')
        },
        {
          path: '/SampleStorage',
          redirect: '/SampleStorage/SampleStorage1',
          // component: Main,
          children: [
            {
              path: 'SampleStorage1',
              component: () => import('./components/test1.vue')
            },
            {
              path: 'SampleStorage2',
              component: () => import('./components/test1.vue')
            }
          ]
        },
        {
          path: '/Laboratory',
          component: () => import('./components/test1.vue')
        },
        {
          path: '/ReportPreparation',
          component: Home
        },
        {
          path: '/ProjectQuality',
          component: Main,
          redirect: '/ProjectQuality/task',
          children: [
            {
              path: 'task',
              component: () => import('./views/ProjectQuality/task.vue')
            }
          ]
        },
        {
          path: '/Laboratory',
          component: Home
        },
        {
          path: '/test',
          name: 'project',
          component: () => import('./views/project/index.vue')
        },
        {
          path: '/about',
          name: 'about',
          // route level code-splitting
          // this generates a separate chunk (about.[hash].js) for this route
          // which is lazy-loaded when the route is visited.
          component: () => import('./views/About.vue')
        },
        {
          path: '/base',
          name: 'base',
          redirect: '/base/MonitoringQualification'
        },
        {
          path: '/base/MonitoringQualification',
          component: () => import('./views/base/MonitoringQualification.vue')
        },
        {
          path: '/base/RatesConfiguration',
          component: () => import('./views/base/RatesConfiguration.vue')
        },
        {
          path: '/base/FormManager',
          component: () => import('./views/base/FormManager.vue')
        },
        {
          path: '/base/EnterpriseInfoManager',
          component: () => import('./views/base/EnterpriseInfoManager.vue')
        },
        {
          path: '/base/EnvironmentManager',
          component: () => import('./views/base/EnvironmentManager.vue')
        },

        {
          path: '/User',
          redirect: '/User/Index',
          component: () => import('./views/User/leftAside.vue'),
          children: [
            {
              path: 'Index',
              component: () => import('./views/User/user_manager.vue')
            },
            {
              path: 'Department',
              component: () => import('./views/User/Department.vue')
            },
            {
              path: 'Role',
              component: () => import('./views/User/RoleRights.vue')
            }
          ]
        }
      ]
    }
  ]
})
